<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<div class="container">
  <div>这是之前的div</div>
  <button>删除新div</button>

</div>
<script>
  //创建一个新的div标签
  let div = document.createElement('div');
  div.innerHTML = '这是新创建的 div';
  div.id = 'one';
  div.className = 'one-div';
  div.style.fontSize = '100px';
  console.log(div);
  //获取到container 对象
  let container = document.querySelector('.container');
  container.appendChild(div);

  let button = document.querySelector('button');
  button.onclick = function(){
    container.removeChild(div)
  }
</script>
</body>
</html>